//var katex = require("katex");

//var gitbaytest = require("./gitbay.js");
//gitbaytest.hi();
//var gitbaykatex = require("../katex-0.13.18/katex.js");

//console.log('gitbaykatex', gitbaykatex);
var  texApi  = require("./tex.js");
//var  katex_test = require("./katextest.js");
//katex_test.hi();
//katex_test.test_tex();

var  errorApi  = require("./check_error.js");

module.exports = {
    book: {
        assets: "./static",
        js: [],
        css: [
            "katex.min.css",
            "tex-without-tears.css"
        ]
    },
    ebook: {
        assets: "./static",
        css: [
            "katex.min.css",
            "tex-without-tears.css"
        ]
    },
    // 钩子函数
    hooks: {
        "page:before": function(page) {
            errorApi.check( page ) ;
            
            return texApi.fix_page_content(page) ; 
        }
    },

 

    // 过滤器
    // 可定义插入视频之类的操作
    // https://github.com/GitbookIO/gitbook/blob/master/docs/plugins/filters.md 
    filters: {},

    // 代码块
    blocks: {
        math: {
            shortcuts: {
                parsers: ["markdown", "asciidoc", "restructuredtext"],
                start: "$$",
                end: "$$"
            },
            process: function(tex_block) {
                // var tex = blk.body; // tex2html(blk.body)
                return texApi.on_block_tex(tex_block) ;  
            }
        }
    }
};
